<?php
namespace app\controllers\api\fans;

use fate\http\Request;

use app\libs\LibUser;
use app\models\Fans;

class UnfollowController extends \fate\web\PureController {

    public function run() {
        // 登录用户关注其他人
        $fansUid = LibUser::getLoginUid();
        if('' === $fansUid) {
            $this->ajaxReturn(null, 200001);
            exit;
        }

        $req = Request::getInstance();
        $uid = $req->getParameter('uid');

        if(!is_numeric($uid)) {
            $this->ajaxReturn(null, 300002);
            exit;
        }

        (new Fans())->unFollow($uid, $fansUid);
        $this->ajaxReturn(null);
    }

}
